
package com.dstz.form.exception;

import com.dstz.base.api.constant.BaseStatusCode;

/**
 * @author xianggang
 *
 */
public class ValidateException extends RuntimeException {
	
	private static final long serialVersionUID = 6886989804271711420L;
	
	/** 错误码 */
	private String errorCode;
	
	/** 错误信息 */
	private String errorMsg;
	
	public ValidateException(String errorCode, String errorMsg) {
		super(String.format("[%s]%s", errorCode, errorMsg));
		this.errorCode = errorCode;
		this.errorMsg = errorMsg;
	}
	
	public ValidateException(Integer errorCode, String errorMsg) {
		super(String.format("[%s]%s", errorCode, errorMsg));
		this.errorCode = errorCode + "";
		this.errorMsg = errorMsg;
	}
	
	public ValidateException(String errorMsg) {
		super(String.format("[%s]%s", BaseStatusCode.PARAM_ILLEGAL, errorMsg));
		this.errorCode = errorCode + "";
		this.errorMsg = errorMsg;
	}
	
	public ValidateException(String errorCode, String errorMsg, Throwable cause) {
		super(cause);
	}
	
	public String getErrorCode() {
		return errorCode;
	}
	
	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}
	
	public String getErrorMsg() {
		return errorMsg;
	}
	
	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}
	
}
